﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucHocVien.ascx.cs" Inherits="STT.Admin.UserControls.ucHocVien" %>

<style>
    .texttitle {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .thediv_scroll1 {
       height:500px;
        width: 100%;
        margin-left: 0px;
        overflow: auto; /* thuoc tinh nay lam xuat hien thanh cuon*/
    }

    #thediv_canle {
        height: 100px;
        margin-left: 0px;
        padding-left: 40px;
        overflow: auto;
    }
</style>

<%--<div id="content-header">
    <div id="breadcrumb">
        <a href="../Admin/Default.aspx?idpage=1" class="tip-bottom" data-original-title="Về bảng điều khiển">
            <i class="icon-home"></i>Trang chính
        </a>
        <a href="../Admin/Default.aspx?idpage=qlhv" class="current">Quản lý học viên</a>
        <a href="#" class="current">Danh sách học viên</a>
    </div>
</div>--%>


<div class="widget-box collapsible">


    
    <%-- Gridview ket qua tim kiem --%>
    <div class="widget-title">
        <a href="#collapseTwo" data-toggle="collapse" class="">
            <span class="icon"><i class="icon-th"></i></span>
            <h5>Danh sách học viên</h5>
        </a>
        <div id="search">
            <asp:TextBox ID="txtTimKiem" runat="server" placeholder="Nhập từ tìm kiếm..."></asp:TextBox>
            <button class="tip-left" data-original-title="Tìm kiếm">
                <asp:ImageButton ID="btSearch" runat="server" ImageUrl="~/img/icon-search.png" OnClick="btSearch_Click" />
            </button>
        </div>
    </div>
    
        
    <div class="in" id="collapseTwo" style="height: auto;">
        <div class="widget-content nopadding">
            <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">

                <asp:GridView ID="gvHocVien" runat="server" CssClass="table table-bordered table-hover"
                    AutoGenerateColumns="False" DataKeyNames="MaHV"
                    OnRowCommand="gvHocVien_RowCommand"
                    EnableViewState="False" OnPageIndexChanging="gvHocVien_PageIndexChanging" OnRowDeleting="gvHocVien_RowDeleting"
                    PageSize="15" AllowPaging="True">
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="cbChonTat" runat="server" onclick="cbChonTat(this);" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="cbChon" runat="server" onclick="cbChon(this);" />
                            </ItemTemplate>
                            <ItemStyle Width="10px" HorizontalAlign="Center"></ItemStyle>
                        </asp:TemplateField>
                        <asp:BoundField DataField="MaHV" HeaderText="Mã học viên"
                            InsertVisible="False" ReadOnly="True" SortExpression="MaHV"
                            ItemStyle-CssClass="span1">
                            <ItemStyle CssClass="span1"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TenHV" HeaderText="Họ"
                            SortExpression="TenHV" ItemStyle-CssClass="span2">
                            <ItemStyle CssClass="span2"></ItemStyle>
                        </asp:BoundField>

                        <asp:BoundField DataField="Ten" HeaderText="Tên" SortExpression="Ten" />
                        <asp:TemplateField HeaderText="Địa chỉ" ShowHeader="False">
                            <ItemStyle Wrap="true" />
                            <ItemTemplate>
                                <div style="width: 100px;">
                                    <asp:Label ID="lbDiaChi" runat="server" Width="100px" CssClass="texttitle" Text='<%# Eval("DiaChi") %>'
                                        ToolTip='<%# Eval("DiaChi") %>'></asp:Label>
                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Sdt" HeaderText="Số điện thoại"
                            SortExpression="Sdt" ItemStyle-CssClass="span2">
                            <ItemStyle CssClass="span2"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TenDonVi" HeaderText="Đơn vị"
                            SortExpression="TenDonVi" ItemStyle-CssClass="span2">
                            <ItemStyle CssClass="span2"></ItemStyle>
                        </asp:BoundField>
                        <asp:BoundField DataField="TenChucVu" HeaderText="Chức vụ"
                            SortExpression="TenChucVu" ItemStyle-CssClass="span2">
                            <ItemStyle CssClass="span2"></ItemStyle>
                        </asp:BoundField>

                        <asp:TemplateField HeaderText="Sửa" ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                                    Text="Sửa" CommandName="ChonSua" CommandArgument="<%#((GridViewRow)Container).RowIndex%>">
                                <img src="../../img/edit.jpg" alt="Alternate Text" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Xóa" ShowHeader="False">
                            <ItemTemplate>
                                <%-- Bắt sự kiện nhấn nút xóa --%>
                                <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete" OnClientClick="return ConfirmDelete('Có chắc bạn muốn xóa?');">
                                <img src="../../img/delete.jpg" alt="Alternate Text" />
                                </asp:LinkButton>
                            </ItemTemplate>
                            <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                          <asp:TemplateField HeaderText="In" ShowHeader="False">
                             <ItemTemplate>
                                <asp:HyperLink ID="btnexport" CssClass="btn btn-primary" Target="_blank" NavigateUrl='<%#"~/Phieuthu.aspx?name=" + Eval("MaHV")  %>' runat="server">                                     Export
                </asp:HyperLink>
                            </ItemTemplate>
                            <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>

                <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl">

                    <asp:LinkButton ID="lbXoaTat" runat="server" CssClass="btn" OnClientClick="return ConfirmDelete('Có chắc bạn muốn xóa các dòng đã chọn?');"
                        OnClick="lbXoaTat_Click">Xóa chọn</asp:LinkButton>

                    <div class="btn-group">
                        <a href="../Admin/Default.aspx?idpage=thv" class="btn">Thêm mới 
                        </a>
                        <button data-toggle="dropdown" class="btn dropdown-toggle">
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            <li></li>
                            <li><a href="#themFileExcel" data-toggle="modal">Thêm từ file Excel</a></li>
                           
                        </ul>
                    </div>

                    <div class="btn-group">
                        <asp:HyperLink ID="HyperLink2" CssClass="btn" Target="_blank" runat="server" NavigateUrl="~/Report/ViewHocVien.aspx" OnDisposed="HyperLink2_Disposed">                        
                            Xuất dữ liệu
                        </asp:HyperLink>
                    </div>

                    <div class="btn-group">
                        <a href="#SuaFileExcel" data-toggle="modal">
                            <button class="btn">Sửa Excel</button>
                        </a>
                    </div>
                    
                    <div class="btn-group">
                        <asp:DropDownList ID="ddlSelectSheet" runat="server" Visible="false"></asp:DropDownList>
                        <asp:Button ID="btOpen" runat="server" Visible="false" Text="Mở file Excel" CssClass="btn btn-primary" OnClick="btOpen_Click" />
                        <asp:Button ID="btSaveImport" Visible="false" runat="server" Text="Import file Excel" CssClass="btn btn-primary" OnClick="btSaveImport_Click" />
                        <asp:Button ID="btSave" runat="server" Visible="false" Text="Lưu file Excel" CssClass="btn btn-primary" OnClick="btSave_Click" />
                        <asp:Button ID="btEdit" runat="server" Visible="false" Text="Mở file Excel" CssClass="btn btn-primary" OnClick="btEdit_Click" />
                        <asp:Button ID="btSaveUpdate" Visible="false" runat="server" Text="Update file Excel" CssClass="btn btn-primary" OnClick="btSaveUpdate_Click" />
                        <asp:Button ID="btSaveEdit" runat="server" Visible="false" Text="Lưu file Excel" CssClass="btn btn-primary" OnClick="btSaveEdit_Click" />
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
    <div class="control-group" style="border: thin solid #CCCCFF;">
        <asp:Panel ID="plError" runat="server" Visible="false">
            <br />
            <div >
                <div id="thediv_canle">
                    <asp:Label ID="lbError" runat="server" ForeColor="Red"></asp:Label>
                </div>
            </div>
            <br />
        </asp:Panel>
    </div>
    <div class="control-group" style="border: thin solid #CCCCFF">
        <asp:Panel ID="pnDSView" runat="server" Visible="false">
            <br />
            <div class="thediv_scroll1">
                <asp:GridView CssClass="table table-hover" ID="gvDSView" runat="server" OnPageIndexChanging="gvDSView_PageIndexChanging"></asp:GridView>
            </div>
            <br />
        </asp:Panel>
    </div>
</div>


<asp:HiddenField ID="hfMaHV" runat="server" />

<div id="themFileExcel" class="modal hide" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3 runat="server" id="H1">Thêm từ file Excel</h3>
    </div>
    <div class="modal-body">
        <asp:FileUpload ID="fuImportExcel" runat="server" />
    </div>
    <div class="modal-footer">
        <asp:Button ID="btLoadImport" runat="server" Text="Load Import" CssClass="btn btn-primary" OnClick="btLoadImport_Click"/>
        <a data-dismiss="modal" class="btn" href="#">Hủy</a>
    </div>
</div>

<div id="SuaFileExcel" class="modal hide" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3 runat="server" id="H2">Sửa từ file Excel</h3>
    </div>
    <div class="modal-body">
        <asp:FileUpload ID="fuSuaExcel" runat="server" />
    </div>
    <div class="modal-footer">
        <asp:Button ID="btLoadUpdate" runat="server" Text="Load Import" CssClass="btn btn-primary" OnClick="btLoadUpdate_Click"/>
        <a data-dismiss="modal" class="btn" href="#">Hủy</a>
    </div>
</div>

<script>
   if('<%= isOpen %>'=='True')
    {
        var height;
        height = $('body')[0].scrollHeight;
        $('body').scrollTop(height/2 + 400);
   }
    function ShowBank(filename) {

        var myWindowName = "Phieuthu";

        var f = 'PhieuThu.aspx?name=' + filename;

        window.open(f, myWindowName, 'left=50, top=30, height=800, width=900, status=yes,resizable= yes, scrollbars= yes, toolbar= no,location= no, menubar= no');
        return f;
    }
 </script> 



